<%@ include file="inc/header.jspf" %>

<script type="text/javascript">
	function turnPage(page) {
		$('#formSearch [name="page"]').val(page);
		$('#formSearch').submit();
	}
</script>

<form id="formSearch" action="search">
	<input type="hidden" name="page" value="1"/>
	<input type="search" name="key" data-inline="true" placeholder="Search...">
</form>


<table data-role="table" class="ui-responsive table-stroke">
	<c:if test="${!empty postList}">
		<thead>
			<tr>
				<th>#</th>
				<th><fmt:message key="category"/></th>
				<th><fmt:message key="title"/></th>
				<th><fmt:message key="date"/></th>
			</tr>
		</thead>
	</c:if>
	<tbody>
		<c:forEach var="post" items="${postList}">
			<tr onclick="location.href = 'detail/${post.postNo}';">
				<td>${post.postNo}</td>
				<td>${post.category.name}</td>
				<td style="cursor: pointer;">${post.title}</td>
				<td><spring:eval expression="post.date"/>
			</tr>
		</c:forEach>
	</tbody>
</table>

<div>
	<button type="button" data-theme="b" data-inline="true" data-icon="plus" onclick="location.href = 'create?category=${post.category.categoryID}';"><fmt:message key="create"/></button>
	<span id="pager">${pager}</span>
</div>

<%@ include file="inc/footer.jspf" %>